﻿namespace TestTool.Tests.Engine.Base.Definitions
{
    using System;
    using System.Collections.Generic;
    using TestTool.Tests.Common.CommonUtils;
    using TestTool.Tests.Definitions.Enums;

    public class FeaturesList
    {
        private List<Feature> _features = new List<Feature>();
        private FeatureDefinitionMode _mode = FeatureDefinitionMode.Default;

        public void AddRange(IEnumerable<Feature> features)
        {
            this._features.AddRange(features);
        }

        public bool Contains(Feature feature)
        {
            return this.ContainsFeature(feature);
        }

        public bool ContainsFeature(Feature feature)
        {
            switch (this._mode)
            {
                case FeatureDefinitionMode.AllSupported:
                    return true;

                case FeatureDefinitionMode.AllNotSupported:
                    return false;
            }
            return this._features.ContainsFeature(feature);
        }

        public List<Feature> Features
        {
            get
            {
                return this._features;
            }
        }

        public FeatureDefinitionMode Mode
        {
            get
            {
                return this._mode;
            }
            set
            {
                this._mode = value;
            }
        }
    }
}

